#!/bin/sh
# postinst script for TransformCoordinate
#
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <postinst> `abort-remove'
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package


case "$1" in
    configure)
        if [ ! -f /usr/share/applications/org.Rabbit.TransformCoordinate.desktop ]; then
            ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/share/applications/org.Rabbit.TransformCoordinate.desktop /usr/share/applications/org.Rabbit.TransformCoordinate.desktop
        fi
        if [ ! -f /usr/share/pixmaps/org.Rabbit.TransformCoordinate.svg ]; then
            if [ ! -d /usr/share/pixmaps ]; then
                mkdir -p /usr/share/pixmaps
            fi
            ln -s @CPACK_PACKAGING_INSTALL_PREFIX@/share/pixmaps/org.Rabbit.TransformCoordinate.svg /usr/share/pixmaps/org.Rabbit.TransformCoordinate.svg
        fi
        export QT_VERSION_DIR=
        if [ -n "${QT_VERSION_DIR}" ]; then
            echo "/opt/qt${QT_VERSION_DIR}/lib" >> /etc/ld.so.conf.d/TransformCoordinate.conf
        fi
        ldconfig
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
        rm -fr /usr/share/applications/org.Rabbit.TransformCoordinate.desktop
        rm -fr /etc/ld.so.conf.d/TransformCoordinate.conf
        rm -fr /usr/share/pixmaps/org.Rabbit.TransformCoordinate.svg
    ;;

    *)
        echo "postinst called with unknown argument \`$1'" >&2
        exit 1
    ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0
